package org.erp.store.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.erp.store.domain.entity.InventoryLog;
import org.erp.store.infrastructure.mapper.InventoryLogMapper;
import org.erp.store.service.InventoryLogService;
import org.springframework.stereotype.Service;

@Service
public class InventoryLogServiceImpl extends ServiceImpl<InventoryLogMapper, InventoryLog> implements InventoryLogService {

    @Override
    public InventoryLog getByIdempotencyKey(String idempotencyKey) {
        return this.getOne(new LambdaQueryWrapper<InventoryLog>()
                .eq(InventoryLog::getIdempotencyKey, idempotencyKey)
                .last("LIMIT 1"));
    }
}